home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / pasclern.zip / READSTOR.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-01  |  790b  |  32 lines

  1. PROGRAM read_and_store_a_file;
  2.  
  3. VAR read_file        : TEXT;
  4.     input_file_name  : STRING[12];
  5.     write_file       : TEXT;
  6.     output_file_name : STRING[12];
  7.     line_number      : INTEGER;
  8.     big_string       : STRING[80];
  9.  
  10. BEGIN
  11.   WRITE('Enter input file name ');
  12.   READLN(input_file_name);
  13.   ASSIGN(read_file,input_file_name);
  14.   RESET(read_file);
  15.  
  16.   WRITE('Enter output file name ');
  17.   READLN(output_file_name);
  18.   ASSIGN(write_file,output_file_name);
  19.   REWRITE(write_file);
  20.  
  21.   line_number := 1;
  22.   WHILE NOT eof(read_file) DO
  23.   BEGIN
  24.     READLN(read_file,big_string);
  25.     WRITE(write_file,line_number:5,'  ');
  26.     WRITELN(write_file,big_string);
  27.     line_number := line_number + 1;
  28.   END;
  29.   CLOSE(read_file);
  30.   CLOSE(write_file);
  31. END.  (* of program *)
  32.